class CurrentCityModel {
  bool? success;
  int? code;
  String? message;
  Data? data;

  CurrentCityModel({this.success, this.code, this.message, this.data});

  CurrentCityModel.fromJson(Map<String, dynamic> json) {
    success = json['success'];
    code = json['code'];
    message = json['message'];
    data = json['data'] != null ? Data.fromJson(json['data']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['success'] = success;
    data['code'] = code;
    data['message'] = message;
    if (this.data != null) {
      data['data'] = this.data!.toJson();
    }
    return data;
  }
}

class Data {
  Result? result;
  String? message;
  String? requestId;
  int? status;

  Data({this.result, this.message, this.requestId, this.status});

  Data.fromJson(Map<String, dynamic> json) {
    result =
    json['result'] != null ? Result.fromJson(json['result']) : null;
    message = json['message'];
    requestId = json['request_id'];
    status = json['status'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = Map<String, dynamic>();
    if (result != null) {
      data['result'] = result!.toJson();
    }
    data['message'] = message;
    data['request_id'] = requestId;
    data['status'] = status;
    return data;
  }
}

class Result {
  String? ip;
  AdInfo? adInfo;
  Location? location;

  Result({this.ip, this.adInfo, this.location});

  Result.fromJson(Map<String, dynamic> json) {
    ip = json['ip'];
    adInfo =
    json['ad_info'] != null ? AdInfo.fromJson(json['ad_info']) : null;
    location = json['location'] != null
        ? Location.fromJson(json['location'])
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = Map<String, dynamic>();
    data['ip'] = ip;
    if (adInfo != null) {
      data['ad_info'] = adInfo!.toJson();
    }
    if (location != null) {
      data['location'] = location!.toJson();
    }
    return data;
  }
}

class AdInfo {
  String? province;
  String? nation;
  String? city;
  int? adcode;
  String? district;
  int? nationCode;

  AdInfo(
      {this.province,
        this.nation,
        this.city,
        this.adcode,
        this.district,
        this.nationCode});

  AdInfo.fromJson(Map<String, dynamic> json) {
    province = json['province'];
    nation = json['nation'];
    city = json['city'];
    adcode = json['adcode'];
    district = json['district'];
    nationCode = json['nation_code'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['province'] = province;
    data['nation'] = nation;
    data['city'] = city;
    data['adcode'] = adcode;
    data['district'] = district;
    data['nation_code'] = nationCode;
    return data;
  }
}

class Location {
  double? lng;
  double? lat;

  Location({this.lng, this.lat});

  Location.fromJson(Map<String, dynamic> json) {
    lng = json['lng'];
    lat = json['lat'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = Map<String, dynamic>();
    data['lng'] = lng;
    data['lat'] = lat;
    return data;
  }
}
